<template>
  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <h1>
        应用详情
        <small>APP 详情与设备概览</small>
      </h1>
    </section>
  
    <!-- Main content -->
    <section class="content container-fluid">
      <div class="row">
        <div class="col-lg-8 col-md-8 col-sm-12 col-xs-12">
          <div class="box box-info">
            <div class="box-header with-border">
              <h3 class="box-title">APP
                <span></span>
              </h3>
            </div>
            <!-- /.box-header -->
            <div class="box-body">
              <div class="form-horizontal">
                <div class="form-group">
                  <label class="col-sm-2 control-label">名称</label>
                  <div class="col-sm-10">
                    <p class="form-control-static">{{appobj.name}}</p>
                  </div>
                </div>
                <div class="form-group">
                  <label for="inputPassword" class="col-sm-2 control-label">编号</label>
                  <div class="col-sm-10">
                    <p class="form-control-static">{{appobj.appid}}</p>
                  </div>
                </div>
                <div class="form-group">
                  <label for="inputPassword" class="col-sm-2 control-label">连接密钥</label>
                  <div class="col-sm-10">
                    <p class="form-control-static">{{appobj.appkey}}</p>
                  </div>
                </div>
                <div class="form-group">
                  <label for="inputPassword" class="col-sm-2 control-label">创建时间</label>
                  <div class="col-sm-10">
                    <p class="form-control-static">{{appobj.create_time}}</p>
                  </div>
                </div>
                <div class="form-group">
                  <label for="inputPassword" class="col-sm-2 control-label">创建备注</label>
                  <div class="col-sm-10">
                    <p class="form-control-static">{{appobj.note}}</p>
                  </div>
                </div>
              </div>
  
            </div>
          </div>
        </div>
      </div>
  
    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->
</template>

<script>
import { mapState, mapGetters } from 'vuex';
var _ = require("lodash");

export default {
  name: 'AppDetail',
  created() {
    document.title = "应用" + this.$route.params.appid;
    if (_.keys(this.apps).length === 0) {
      this.$store.dispatch('load_apps');
    }
  },
  computed: {
    appobj: function(args) {
      let appid = parseInt(this.$route.params.appid);
      return this.apps[appid];
    },
    ...mapGetters([
      'apps',
    ]),
  }
}
</script>
